$(function () {
    //弹出支付窗口
    $(".goPay").click(function () {
        $("#payNow").animate({
            bottom: '0',
        });
    });
    //支付完成隐藏
    $(".payfor").click(function () {
        $("#payNow").animate({
            bottom: '-6rem',
        });
        location.assign("../html/paysuccess.html");
    });
    //退出支付
    $("a").click(function () {
        $("#payNow").animate({
            bottom: '-6rem',
        });
    });
    //获取本地购票信息
    var appMovie = {};
    appMovie.img = 'movie.png';
    appMovie.name = ' 哥斯拉大战金刚';
    appMovie.order = '72132342241';
    appMovie.map = ' 成都双楠电影城•英文2D';
    appMovie.startDay = ' 2020-04-16 星期一';
    appMovie.seat = ' F4  F5  F6';
    appMovie.price = ' 120.00';
    appMovie.hour = '19:00';
    //座位的length
    appMovie.seatNum = '3';
    var waitPay = JSON.stringify(appMovie);
    localStorage.setItem('appMovies', waitPay);
    //拿取信息
    var get = localStorage.getItem('appMovies');
    var take = JSON.parse(get);

    var img = take.img;
    var order = take.order;
    var names = take.name;
    var map = take.map;
    var startDay = take.startDay;
    var seat = take.seat;
    var price = take.price;
    var hour = take.hour;
    var seatNum = take.seatNum;
    //新建
    var $newLeft = $("<div class='left'></div>");
    var $newRight = $("<div class='right'></div>");
    var $newList1 = $("<div class='list-one'></div>");
    var $newList2 = $("<div class='list-two'></div>");
    var $newPay = $("<span></span>");

    $newLeft.html(` <img src="../images/${img}" alt="">`);
    $newRight.html(
        `<ul>
            <li class="order">订单号：${order}</li>
            <li class="name">${names}</li>
            <li class="map">${map}</li>
        </ul>`
    );
    $newList1.html(
        `<ul>
            <li>
                观影日期
            </li>
            <li class="startDay">
            ${startDay}
            </li>
            <li>
                座位
            </li>
            <li class="seat">
                <div class="s1">
                ${seat[0]}
                </div>
                <div class="s1">
                    F5
                </div>
                <div class="s1">
                    F6
                </div>
            </li>
            <li>
                总价
            </li>
            <li class="price">
                ￥${price}
            </li>
            <li>
                优惠
            </li>
            <li class="discount">
                -￥0.00
            </li>
        </ul>`
    );
    $newList2.html(
        `<ul>
            <li>
                时间
            </li>
            <li class="hour">
                ${hour}
            </li>
            <li>
                座位总数
            </li>
            <li class="seatNum">
            ${seatNum}
            </li>
            <li>
                服务费
            </li>
            <li class="service">
                ￥3.00
            </li>
        </ul>`
    );
    $newPay.html(
        `<ul>
            <li>
                <span>总计</span>
                <span class="needPay">￥${price + 3}</span>
            </li>
            <li>
                <button class="goPay">去支付</button>
            </li>
        </ul>`
    );

    // 回退
    $("header").on('click','a',function() {
        history.go(-1);
    });
});


